package algorithms.leecode;

public class Au803 {
    public static void main(String[] args) {
        System.err.println(4 ^ 7);
        System.err.println(new Au803().countPairs(new int[]{1,4,2,7},2,6));
    }
    public int countPairs(int[] nums, int low, int high) {
        int count = 0;


        if (nums.length < 2) {
            return 0;
        }
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (isT(nums,low,high,i,j)) {
                    count++;
                }
            }
        }
        return count;

    }
    public boolean isT(int[] nums, int low, int high,int i, int j) {
        if((nums[i] ^ nums[j]) <= high && (nums[i] ^ nums[j]) >= low ) {
            return true;
        }
        return false;
    }
}
